package com.hunttown.mes.rpc.domain.enums.expense;

import java.util.HashMap;
import java.util.Map;

/**
 * 报销类型：1司机费用 2采购报销 3配件报销 4维修报销 5综合报销 6借款申请 7费用支付
 * created by wangjunfu on 2018/11/6
 */
public enum BXTypeEnum {
    DRIVER(1, "司机费用"),
    PURCHASE(2, "采购报销"),
    PARTS(3, "配件报销"),
    REPAIR(4, "维修报销"),
    DAILY(5, "综合报销"),
    BORROW(6, "借款申请"),
    PAY(7, "费用支付");

    private final int key;
    private final String value;

    BXTypeEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    // 根据key获取枚举
    public static String getEnumByKey(int key) {
        String value = "";

        for (BXTypeEnum temp : BXTypeEnum.values()) {
            if (temp.getKey() == key) {
                value = temp.getValue();
            }
        }

        return value;
    }

    // 将枚举组成Map
    public static Map<Integer, String> getEnumList() {
        Map<Integer, String> map = new HashMap<>();

        for (BXTypeEnum temp : BXTypeEnum.values()) {
            map.put(temp.getKey(), temp.getValue());
        }

        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
